<admintpl file="header" />
<style type="text/css">
    .radio {
        margin-top: 5px;
        margin-left: 15px;
        float: left;
    }
</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">

            <li><a href="{:U('Qrcode/index')}">二维码列表</a></li>
            <li class="active"><a href="{:U('Qrcode/add')}">创建二维码</a></li>
		</ul>
		<form action="{:U('Qrcode/add_post')}" method="post" class="form-horizontal js-ajax-form" enctype="multipart/form-data">
			<div class="row-fluid">
				<div class="span12">
					<table class="table table-bordered">
						<tr>
							<th>标题</th>
							<td>
								<input type="text" name="name"  value="" placeholder="请输入标题"/>
							</td>
						</tr>
						<tr>
							<th>类型</th>
							<td>
			                <foreach name="type" item="vo">
			                    <label class="radio">
			                        <input type="radio" name="qtype" class="code_type" value="{$vo.id}">
			                        <span>{$vo.name}</span>
			                    </label>
			                </foreach>
							</td>
						</tr>
						<tr id="expire">
							<th>有效期</th>
							<td>
								<select name="expire">
					                <for start="1" end="31">
					                	<option value="{$i*60*60*24}">{$i} 天 ({$i*60*60*24} 秒)</option>
					                </for>
				               	</select>
							</td>
						</tr>
						<tr>
							<th>说明</th>
							<td>
								<input type="text" name="description"  placeholder="请填写说明"/>
							</td>
						</tr>
					</table>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary js-ajax-submit" type="submit">提交</button>
				<a class="btn" href="{:U('Qrcode/index')}">返回</a>
			</div>
		</form>
	</div>
	<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript">
    $(".code_type").change(function () {
        switch (this.value) {
            case '0': //物料类型为红包
                $("#expire").css('display', '');
                break;
            default:
                $("#expire").css('display', 'none');
                break;
        }
    });
    </script>
</body>
</html>